1. Field of the Invention
The present invention relates to a computer system, and deals more particularly with a method, system, and computer-readable code for dynamically constructing Document Object Model trees for Extensible Markup Language documents. A composite tree is constructed by using the results of a dynamic data retrieval, along with a predefined static portion of a tree, to create the resulting composite tree.
2. Description of the Related Art
Document Object Model, or xe2x80x9cDOMxe2x80x9d, is a language-independent application programming interface (xe2x80x9cAPIxe2x80x9d) for use with documents specified in the Standard Generalized Markup Language (xe2x80x9cSGMLxe2x80x9d) or a derivative of SGML. SGML is a language that provides for a platform-independent specification of document content and formatting. In particular, DOM is intended for use with the HyperText Markup Language (xe2x80x9cHTMLxe2x80x9d) and Extensible Markup Language (xe2x80x9cXMLxe2x80x9d) derivatives of SGML. DOM is published as a Recommendation of the World Wide Web Consortium, titled xe2x80x9cDocument Object Model (DOM) Level 1 Specification, Version 1.0xe2x80x9d (1998) and available on the World Wide Web at http://www.w3.org/TR/RECDOM-Level-1. (Refer to ISO 8879, xe2x80x9cStandard Generalized Markup Language (SGML)xe2x80x9d, (1986) for more information on SGML. Refer to xe2x80x9cExtensible Markup Language (XML), W3C Recommendation Feb. 10, 1998xe2x80x9d which is available on the World Wide Web at http://www.w3.org/TR/1998/REC-xml-19980210, for more information on XML.)
The DOM API enables application programs to access a tree-oriented abstraction of a document, and to manipulate document structure and contents (that is, by changing, deleting, and/or adding elements). Further, the DOM enables navigating the structure of the document. While the term xe2x80x9cdocumentxe2x80x9d is used herein when discussing XML and the corresponding DOM trees, it is to be understood that the information represented using XML may represent any type of information, and is not limited to the traditional interpretation of the word xe2x80x9cdocumentxe2x80x9d. For example, XML may be used to represent the layout of a user interface for an application program, or the data to be used with a program. For ease of reference, the term xe2x80x9cdocumentxe2x80x9d will be used herein to refer to these diverse types of information. xe2x80x9cDOM treexe2x80x9d refers to the logical structure with which a document is modelled using the DOM. A DOM tree is a hierarchical representation of the document structure and contents. Each DOM tree has a root node and one or more leaf nodes, with zero or more intermediate nodes, using the terminology for tree structures that is commonly known in the computer programming art. A node""s predecessor node in the tree is called a xe2x80x9cparentxe2x80x9d and nodes below a given node in the tree are called xe2x80x9cchildxe2x80x9d nodes.
While the DOM applies to both HTML and XML, HTML is not pertinent to the scope of the present invention. Thus, the subsequent DOM discussions will be in terms of using the DOM with XML. XML is a standardized formatting notation, created for structured document interchange on the World Wide Web (hereinafter, xe2x80x9cWebxe2x80x9d). XML is a tag language, where specially-designated constructs referred to as xe2x80x9ctagsxe2x80x9d are used to delimit (or xe2x80x9cmark upxe2x80x9d) information. In the general case, a tag is a keyword that identifies what the data is which is associated with the tag, and is typically composed of a character string enclosed in special characters. xe2x80x9cSpecial charactersxe2x80x9d means characters other than letters and numbers, which are defined and reserved for use with tags. Special characters are used so that a parser processing the data stream will recognize that this a tag. A tag is normally inserted preceding its associated data: a corresponding tag may also be inserted following the data, to clearly identify where that data ends. As an example of using tags, the syntax xe2x80x9c less than email greater than xe2x80x9d could be used as a tag to indicate that the character string appearing in the data stream after this tag is to treated as an e-mail address; the syntax xe2x80x9c less than /email greater than xe2x80x9d would then be inserted after the character string, to delimit where the e-mail character string ends.
The syntax of XML is extensible, providing users the capability to define their own tags. As previously stated, XML is based on SGML, which is an international standard for specifying document structure. XML is a simplified version of SGML, tailored to Web document content.
XML is widely accepted in the computer industry for defining the semantics (that is, by specifying meaningful tags) and content of the data encoded in a file. The extensible, user-defined tags enable the user to easily define a data model, which may change from one file to another. When an application generates the tags (and corresponding data) for a file according to a particular data model and transmits that file to another application that also understands this data model, the XML notation functions as a conduit, enabling a smooth transfer of information from one application to the other. By parsing the tags of the data model from the received file, the receiving application can re-create the information for display, printing, or other processing, as the generating application intended it.
Note that the word xe2x80x9cfilexe2x80x9d is used throughout this disclosure to refer to stored data. This is for ease of reference only, and is not meant to imply any particular structure for storing the data, such as conventional xe2x80x9cflat filesxe2x80x9d. The data with which the present invention may be beneficially used may be stored in any number of ways without deviating from the inventive concepts disclosed herein, such as: a data element in a database, an object attribute in a directory entry, an object in flash memory, etc.
When an XML parser processes an XML file, it reads the file and constructs a DOM tree based on the syntax of the tags embedded in the file and the interrelationships between those tags. The tag syntax is stored in the nodes of the DOM tree, and the shape of the tree is determined from the tag relationships. The DOM specification is defined to provide xe2x80x9cstructural isomorphismxe2x80x9dxe2x80x94that is, any XML parser that parses a given XML input file will create an identical DOM tree. The DOM interface is used to change the structure and/or contents of the DOM tree, as previously stated. (Optionally, the XML document may also be revised to reflect this changed information.)
XML may be used to represent any type of structured information, as stated previously. One area in which XML is increasingly important is with on-line directory services. xe2x80x9cDirectory servicexe2x80x9d refers generically to a repository of information, along with the access methods and other services that are used with the repository. A particular approach to implementation of a directory service is specified as an international standard in ISO/IEC 9594-1, xe2x80x9cThe Directory: Overview of Concepts, Models, and Servicesxe2x80x9d (1995), which is also published as ITU Recommendation X.500. An xe2x80x9cX.500 Directoryxe2x80x9d is a directory service according to these specifications. X.500 directories are widely used in the Internet and Web for providing centralized storage and management of information. XML notation is one form in which information may be stored within a directory.
A communications protocol is used to access the stored information in an on-line directory. A popular protocol for accessing directories, such as X.500 directories, is the Lightweight Directory Access Protocol (hereinafter, xe2x80x9cLDAPxe2x80x9d). LDAP does not require X.500 directory services, and many implementations of LDAP use directory stores other than X.500. LDAP is specified as IETF (Internet Engineering Task Force) RFC (Request For Comments) 2251. When using LDAP with a directory, the queries to the database (and the results of these queries) may be specified using a proxy that translates between LDAP API calls and XML syntax. The phrase xe2x80x9cLDAP Directoryxe2x80x9d is used herein to refer to directories accessed using LDAP.
The flexibility of XML enables it to be used to represent complex information. Using the DOM APIs, XML can be used not just with information that is static in nature, but also with information that changes dynamically. With changing information, a DOM tree is created that represents an initial state of the information; this DOM tree may then be altered to reflect the dynamic changes. If new content is required, new nodes are added to the DOM tree to reflect the changed state of the content. The corresponding nodes are removed from the DOM tree if content is to be deleted. And the nodes of the DOM tree are changed when content is to be changed.
Currently, DOM trees are only updated using the DOM APIs upon a specific API invocation from an executing application program. It would be advantageous to be able to specify directly in the content of an XML document that this content (or selected portions thereof) is dynamic in nature, such that specific values in the content are to be dynamically obtained when an application program is ready to use the XML document. As a further extension of this concept, it would be advantageous to provide a mechanism for dynamically refreshing the content of an XML document according to a specified set of conditions, which may include periodic refreshes. There are no known techniques with which this type of dynamic processing can be specified in XML content (nor with which the corresponding DOM trees can be updated).
Accordingly, a need exists for a technique with which documents encoded according to the XML notation can be marked up to indicate that the content of the document (or some portion thereof) is dynamic in nature and is to be updated dynamically to reflect changing information. The proposed technique provides a novel way to specify that a data repository should be accessed as the source of the updates. Techniques are defined for specifying that this data repository access occurs once, and for specifying that it is to be refreshed when a set of conditions are satisfied (which may include periodically repeating the data repository access and content update). Preferably, LDAP is used as an access method when the data repository being accessed is an LDAP directory.
An object of the present invention is to provide a technique whereby documents encoded according to the XML notation can be marked up to indicate that the content of the document (or some portion thereof) is dynamic in nature.
Another object of the present invention is to provide a technique whereby documents encoded according to the XML notation can be marked up to indicate that the corresponding DOM tree is to be updated dynamically to reflect changing information.
Still another object of the present invention is to provide this technique whereby the XML markup specifies that a data repository should be accessed as the source of the updates.
It is another object of the present invention to provide this technique whereby the markup specifies that a dynamic update occurs once.
A further object of the present invention is to provide this technique whereby the markup specifies that a dynamic refresh occurs when a set of conditions are satisfied (which may include periodically repeating the data repository access and content update).
Yet another object of the present invention is to provide this technique whereby LDAP is used as an access method, and where the data repository being accessed is an LDAP directory.
Other objects and advantages of the present invention will be set forth in part in the description and in the drawings which follow and, in part, will be obvious from the description or may be learned by practice of the invention.
To achieve the foregoing objects, and in accordance with the purpose of the invention as broadly described herein, the present invention provides a software-implemented process, a system, and a method for use in a computing environment having a connection to a network, for dynamically constructing DOM trees using dynamic data retrievals. This comprises: reading an input file encoded in a derivative of Standard Generalized Markup Language (SGML); creating a DOM tree from the encoded file during the reading; traversing the created DOM tree; detecting one or more dynamic data retrieval tags in the DOM tree during the traversing; invoking a dynamic data retrieval for each of the detected data retrieval tags, wherein the dynamic query uses one or more parameters specified for the detected data retrieval tag; and reflecting results of each of the dynamic data retrievals in said created DOM tree. As one option, this may further comprise updating the encoded file to reflect the results of each of the dynamic data retrievals. As an alternative option, this may further comprise: detecting one or more error-handling tags that may be specified with each of the detected data retrieval tags; and wherein the reflecting results further comprises using a default specification from the detected error-handling tags when the dynamic data retrieval returns an error condition. With this alternative option, the encoded file may be updated to reflect the results of each of the dynamic data retrievals, as in the first option, but wherein the updating further comprises using the default specification from the detected error-handling tags when the dynamic data retrieval returns an error condition. Preferably, the derivative is Extensible Markup Language (XML).
The process, system, and method may further comprise: substituting a value of a variable name for a dynamic reference to the variable name; and using the substituted value during the dynamic data retrieval. Or, they may further comprise: detecting one or more conditional refresh tags in the DOM tree during the traversing; evaluating the conditional refresh tags; and refreshing the DOM tree when the conditional tag evaluates to true. The detected dynamic retrieval tags may specify one or more of: a database query retrieval and a file system retrieval. Optionally, these may further comprise: detecting a periodic refresh syntax specified with one or more of the detected database query retrieval tags; and periodically refreshing the DOM tree according to the periodic refresh syntax.
The present invention will now be described with reference to the following drawings, in which like reference numbers denote the same element throughout.